#pragma once
#include <vector>
#include <nds.h>
#include <unistd.h>
#include <stdio.h>
#include <malloc.h>
#include <fat.h>
#include <iostream>
#include "enum.h"

class Sprite;

struct CharacterData{
	unsigned int strength;
	unsigned int defense;
	unsigned int speed;

	Bonuses bonuses; 
	Penalties penalties; 

	std::vector<Sprite*> animImages; 
	std::vector<Sprite*> animImages_top;
	unsigned int firstOAM_ID;
	unsigned int firstOAM_TOP_ID;
};

struct EnemyFile{
	int posX;
	int posY;
	int type;
};

struct ManaFile{
	int posX;
	int posY;
};

struct DecorFile{
	int posX;
	int posY;
	DecorType type;
};

std::vector<char*> parseLevelFile (u8* buffer, int size);
std::vector<int> parseLineNumbers (char* line);

void parseBackgroundFile (std::string fileName, std::vector<int> & backgroundSwitch);
void parseSpriteFile (std::string fileName, std::vector<DecorFile> & decorElements, std::vector<EnemyFile> & enemies, std::vector<ManaFile> & manaBottles);
void parseInfoFile (std::string fileName, int & levelSize, std::vector<int> & unlockedTransfos);
void parseUnfinishedLevelsFile(std::vector<int> & unfinishedLevels);
void parseLockedTransfosFile(std::vector<int> & lockedTransfos);

void saveFinishedLevel(int currentLevel);
void saveLockedTransfos(std::vector<int> unlockedTransfos);

void inverseTransfos(std::vector<int> & unlockedTransfos, std::vector<int> & forbiddenTransfos);
void inverseLevels(std::vector<int> & unfinishedLevels, std::vector<int> & finishedLevels);